package own.stu.jobgib.playown.redis.redisson;

import org.redisson.Redisson;
import org.redisson.api.RedissonClient;
import org.redisson.config.Config;

public class BaseTest {

    static RedissonClient client;

    public static RedissonClient getClient() {
        Config config = new Config();
        config.useSingleServer()
                .setConnectionMinimumIdleSize(4)
                .setAddress("redis://localhost:6379"); // 修改hosts文件
        client = Redisson.create(config);
        return client;
    }

    public static void close() {
        if (client == null) {
            return;
        }
        client.shutdown();
    }
}
